<?php
namespace app\api\controller;

use app\common\controller\ApiBase;
use think\Db;



header('Access-Control-Allow-Origin:*');
header("Access-Control-Allow-Credentials:true");
header("Access-Control-Max-Age:3600");
header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,SessionToken,Token,ID");
header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS');


class Check extends ApiBase
{
    public $uid;
  	private $check=[];
      protected function _initialize(){
        parent::_initialize();
        $headers = request()->header();
        //$headers['id']='1';
        //$headers['token']='14F2F881F323FCD9F8D65DD00FB09C78';
        if(!isset($headers['id'])||!isset($headers['token'])){
          $this->splash(-1,'配置错误，请检查配置')->send();
		  exit;
        }
      	$this->check = $this->check_token($headers['id'],$headers['token']);
        if($this->check['Status']==0){
          $this->splash(-2,$this->check['Message'])->send();
          exit;
        }
        $this->uid = $headers['id'];
    }
}
